﻿Public Class DmKheUocVay

    '  Private Sub FormLoaikhachhang_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
        '  If e.KeyCode = (e.Control And Keys.N) Then
        If keyData = (Keys.Control Or Keys.N) Then
            Return Me.DmkhueuocvayIUltraGrid.getTaoMoi()
        End If
        If keyData = (Keys.Control Or Keys.S) Then
            Me.DmkhueuocvayIUltraGrid.getLuu()
            Return True
        End If
        If keyData = (Keys.Control Or Keys.D) Then
            Return Me.DmkhueuocvayIUltraGrid.getXoa()
        End If
        If keyData = (Keys.Control Or Keys.R) Then
            Return Me.DmkhueuocvayIUltraGrid.getRefresh()
        End If
        If keyData = (Keys.Control Or Keys.P) Then
            Return getIn()
        End If
        If keyData = (Keys.Control Or Keys.Q) Then
            Return getThoat()
        End If
        Return MyBase.ProcessCmdKey(msg, keyData)
    End Function


    Private Sub DmKhueUocVay_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'ErpharmaDataSet.dmkheuocvay' table. You can move, or remove it, as needed.

        Me.Cursor = Cursors.WaitCursor
        Me.DmkheuocvayTableAdapter.Fill(Me.ErpharmaDataSet.dmkheuocvay)
        Me.DmtinhtrangTableAdapter.Fill(Me.ErpharmaDataSet.dmtinhtrang)
        Me.DmkhueuocvayIUltraGrid.setDoiTuongXuLyDuLieu(Me.ErpharmaDataSet.dmkheuocvay, Me.DmkheuocvayBindingSource, Me.DmkheuocvayTableAdapter, Me.ErpharmaDataSet)
        Me.DmkhueuocvayIUltraGrid.setGiaoDienVua()
        Me.DmkhueuocvayIUltraGrid.setTimKiemTrenCotUltraGrid()
        Me.DmkhueuocvayIUltraGrid.setChoPhepMenuStrip_In()
        Me.DmkhueuocvayIUltraGrid.setThemIUltraDropDown(Me.DmtinhtrangIUltraDropDown, Me.ErpharmaDataSet.dmtinhtrang)
        Me.DmtinhtrangIUltraDropDown.setGiaoDien_An_ColumnHeader()
        Me.Cursor = Cursors.Default

    End Sub

    Private Sub btnTaoMoi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTaoMoi.Click
        Me.DmkhueuocvayIUltraGrid.getTaoMoi()

    End Sub

    Private Sub btnLuu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLuu.Click
        Me.DmkhueuocvayIUltraGrid.getLuu()

    End Sub

    Private Sub btnXoa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnXoa.Click
        Me.DmkhueuocvayIUltraGrid.getXoa()

    End Sub

    Private Sub btnLamTuoi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLamTuoi.Click
        Me.DmkhueuocvayIUltraGrid.getRefresh()

    End Sub
    Private Function getIn() As Boolean
        Try
            Dim rp As DmKhueUocVay_Report = New DmKhueUocVay_Report
            rp.setDt(Me.DmkhueuocvayIUltraGrid.getDatatableTuIUltraGrid("dmkheuocvay"))
            rp.Show()
            Me.DmkhueuocvayIUltraGrid.DataSource = Me.ErpharmaDataSet.dmkheuocvay
        Catch ex As Exception
            ' Return False
            MsgBox("Xảy ra lỗi :" & ex.Message, MsgBoxStyle.Information, "Thông báo")
        End Try
        Return True
    End Function
    Private Sub btnIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIn.Click
        getIn()
    End Sub
    Private Function getThoat() As Boolean
        Try
            Me.Dispose()
            Me.Close()
        Catch ex As Exception
            Return False
        End Try
        Return True
    End Function
    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        getThoat()
    End Sub
End Class